<?php
class TactionController extends AppController {

	var $name = 'Taction';
	var $components = array('Xacl');

	/**
	 * all actions list
	 *
	 */
	function index()
	{

		$this->paginate = array('fields'=>array('Taction.id', 'Taction.f_action', 'Taction.f_desc'), 'limit'=>10, 'order'=>'Taction.f_action desc');

		$this->loadModel("Taction");

		$this->set('actionlist', $this->paginate($this->Taction));
		$this->layout = 'tuser';
	}

	/**
	 * set description for action 
	 *
	 */
	function setdesc()
	{
		$data = array(
		'id'=> isset($_POST['id']) ? trim($_POST['id']) : null,
		'f_desc'=> isset($_POST['fdesc']) ? trim($_POST['fdesc']) : null,
		);
		if(!empty($data['id']))
		{
			$this->Taction->save($data);
			$this->flash('保存成功!','/taction/');
			return ;
		}

		$this->flash('操作无效!','/taction/');
		return ;
	}
	/**
	 * delete action record
	 *
	 * @param int $id	action id
	 */
	function delaction($id=NULL)
	{

		if(NULL == $id)
		{
			$this->flash('操作无效!','/taction/');
			return ;
		}
		$this->Taction->id=$id;
		$this->Taction->delete();
		$this->flash('操作成功!','/taction/');
	}
}
?>
